<?php
require_once 'layout.php';

$title = "SSL证书详情";
$currentPage = "products";

$content = '
<section class="hero" style="padding: 30px 0; background: var(--bg-light);">
    <div class="container">
        <div class="breadcrumb">
            <a href="/" style="color: var(--text-light); text-decoration: none;">首页</a>
            <span style="margin: 0 10px; color: var(--text-light);">/</span>
            <a href="/products" style="color: var(--text-light); text-decoration: none;">SSL证书</a>
            <span style="margin: 0 10px; color: var(--text-light);">/</span>
            <span style="color: var(--text-dark);">证书详情</span>
        </div>
    </div>
</section>

<section class="section">
    <div class="container">
        <div id="product-detail-container">
            <!-- 产品详情将通过JavaScript动态加载 -->
            <div class="loading-placeholder" style="text-align: center; padding: 30px 0 50px;">
                <div style="display: inline-block; width: 50px; height: 50px; border: 4px solid var(--border-gray); border-radius: 50%; border-top: 4px solid var(--primary-blue); animation: spin 1s linear infinite;"></div>
                <p style="margin-top: 20px; color: var(--text-light); font-size: 1.1rem;">加载产品详情中...</p>
            </div>
        </div>
        
        <div class="related-products" style="margin-top: 50px;">
            <h2 class="section-title">相关产品推荐</h2>
            <div class="products-grid" style="margin-top: 40px;">
                <div class="product-card">
                    <div class="product-header">
                        <div class="product-brand">
                            <svg width="80" height="40" viewBox="0 0 80 40" xmlns="http://www.w3.org/2000/svg">
                                <rect width="80" height="40" rx="6" fill="#ffffff" opacity="0.2"/>
                                <text x="40" y="24" text-anchor="middle" fill="white" font-size="12">DigiCert</text>
                            </svg>
                        </div>
                        <h3>标准型DV证书</h3>
                        <div class="product-price">¥488/年</div>
                        <p>适合中小型企业网站</p>
                    </div>
                    <div class="product-body">
                        <ul class="product-features">
                            <li><span>加密强度</span><span>256位RSA</span></li>
                            <li><span>验证类型</span><span>域名验证</span></li>
                            <li><span>支持域名</span><span>单域名</span></li>
                            <li><span>保险金额</span><span>$25,000</span></li>
                        </ul>
                        <a href="/product?id=2" class="btn btn-primary" style="width: 100%;">查看详情</a>
                    </div>
                </div>
                
                <div class="product-card">
                    <div class="product-header">
                        <div class="product-brand">
                            <svg width="80" height="40" viewBox="0 0 80 40" xmlns="http://www.w3.org/2000/svg">
                                <rect width="80" height="40" rx="6" fill="#ffffff" opacity="0.2"/>
                                <text x="40" y="24" text-anchor="middle" fill="white" font-size="12">Sectigo</text>
                            </svg>
                        </div>
                        <h3>多域名证书</h3>
                        <div class="product-price">¥2,888/年</div>
                        <p>保护多个不同域名</p>
                    </div>
                    <div class="product-body">
                        <ul class="product-features">
                            <li><span>加密强度</span><span>256位RSA/ECC</span></li>
                            <li><span>验证类型</span><span>组织验证</span></li>
                            <li><span>支持域名</span><span>最多100个</span></li>
                            <li><span>保险金额</span><span>$100,000</span></li>
                        </ul>
                        <a href="/product?id=3" class="btn btn-primary" style="width: 100%;">查看详情</a>
                    </div>
                </div>
                
                <div class="product-card">
                    <div class="product-header">
                        <div class="product-brand">
                            <svg width="80" height="40" viewBox="0 0 80 40" xmlns="http://www.w3.org/2000/svg">
                                <rect width="80" height="40" rx="6" fill="#ffffff" opacity="0.2"/>
                                <text x="40" y="24" text-anchor="middle" fill="white" font-size="12">GlobalSign</text>
                            </svg>
                        </div>
                        <h3>代码签名证书</h3>
                        <div class="product-price">¥3,888/年</div>
                        <p>为软件和应用程序签名</p>
                    </div>
                    <div class="product-body">
                        <ul class="product-features">
                            <li><span>签名类型</span><span>代码签名</span></li>
                            <li><span>验证类型</span><span>组织验证</span></li>
                            <li><span>支持平台</span><span>Windows/Mac</span></li>
                            <li><span>有效期</span><span>1-3年</span></li>
                        </ul>
                        <a href="/product?id=4" class="btn btn-primary" style="width: 100%;">查看详情</a>
                    </div>
                </div>
            </div>
        </div>
        
        <div class="purchase-guide" style="margin-top: 80px; background: var(--bg-light); padding: 50px; border-radius: 12px;">
            <h2 style="text-align: center; margin-bottom: 30px;">购买流程</h2>
            <div class="process-steps" style="display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 30px;">
                <div class="step" style="text-align: center;">
                    <div style="width: 60px; height: 60px; background: var(--primary-blue); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; color: white; font-size: 1.5rem; font-weight: bold;">1</div>
                    <h4>提交订单</h4>
                    <p style="color: var(--text-light); margin-top: 10px;">填写域名信息，完成订单提交和付款</p>
                </div>
                <div class="step" style="text-align: center;">
                    <div style="width: 60px; height: 60px; background: var(--primary-blue); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; color: white; font-size: 1.5rem; font-weight: bold;">2</div>
                    <h4>域名验证</h4>
                    <p style="color: var(--text-light); margin-top: 10px;">按照指引完成域名所有权验证</p>
                </div>
                <div class="step" style="text-align: center;">
                    <div style="width: 60px; height: 60px; background: var(--accent-green); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; color: white; font-size: 1.5rem; font-weight: bold;">3</div>
                    <h4>获取证书</h4>
                    <p style="color: var(--text-light); margin-top: 10px;">验证通过后即可下载安装SSL证书</p>
                </div>
            </div>
            
            <div style="text-align: center; margin-top: 60px;">
                <a href="/contact" class="btn btn-primary">联系购买</a>
                <a href="/help" target="_blank" class="btn btn-outline" style="margin-left: 20px;">安装指导</a>
            </div>
        </div>
    </div>
</section>

<style>
.product-detail {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.product-detail-header {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-blue) 100%);
    color: white;
    padding: 60px;
    text-align: center;
}

.product-brand-large {
    margin: 0 auto 30px;
}

.product-detail-header h1 {
    font-size: 2.5rem;
    margin-bottom: 20px;
}

.product-price-large {
    font-size: 3rem;
    font-weight: bold;
    color: var(--accent-green);
    margin-bottom: 20px;
}

.product-description {
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

.product-detail-content {
    padding: 60px;
}

.product-specs {
    margin-bottom: 50px;
}

.product-specs h3 {
    font-size: 1.8rem;
    color: var(--text-dark);
    margin-bottom: 30px;
    text-align: center;
}

.specs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.spec-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--bg-light);
    border-radius: 8px;
}

.spec-label {
    font-weight: 500;
    color: var(--text-dark);
}

.spec-value {
    font-weight: bold;
    color: var(--primary-blue);
}

.product-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.error {
    text-align: center;
    padding: 60px 0;
    color: var(--text-light);
    font-size: 1.2rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    .product-detail-header {
        padding: 40px 30px;
    }
    
    .product-detail-header h1 {
        font-size: 2rem;
    }
    
    .product-price-large {
        font-size: 2.5rem;
    }
    
    .product-detail-content {
        padding: 40px 30px;
    }
    
    .specs-grid {
        grid-template-columns: 1fr;
    }
    
    .product-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .btn-large {
        width: 100%;
        max-width: 300px;
    }
    
    .process-steps {
        grid-template-columns: 1fr !important;
    }
}
</style>

<script src="/static/js/product-detail.js"></script>
<script>
document.addEventListener("DOMContentLoaded", function() {
    // 初始化产品详情页面
    if (typeof initProductDetailPage === "function") {
        initProductDetailPage();
    }
});
</script>
';

renderPage($title, $content, $currentPage);
